package seqlist.leetcode;

//判断链表是否带环
public class Num141_hasCycle {
    public boolean hasCycle(ListNode head) {
        ListNode fast=head;
        ListNode low=head;
        while (fast!=null&&fast.next!=null){
            fast=fast.next.next;
            low=low.next;
            if(fast==low){
                return true;
            }
        }
        return false;
    }
}
